/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.srcptit.trainning.thompv.btvn2;
import java.util.Scanner;
/**
 *
 * @author SONY
 */
public class Bai1
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int a,b,t=0;
        char s[]=new char[100];
        System.out.println("nhap so can chuyen:");
        a=sc.nextInt();
        System.out.println("nhap co so can chuyen: ");
        b=sc.nextInt();
        while(a>0)
        {
            int du=a%b;
            if(a%b>10)
                s[t]=(char)('A'+du-10);
            else s[t]=(char)('0'+du);
            t++;
            a=a/b;
        }
        String s2=new String(s,0,t);
        StringBuffer x;
        x=new StringBuffer(s2);
        s2=x.reverse().toString();
        System.out.println("Ket qua: ");
        System.out.println(s2);
    }
}
